package com.controller;


import com.common.Result;
import com.pojo.Category;
import com.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "类别管理", value = "类别管理")
@CrossOrigin
@RestController
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @ApiOperation(value = "查询商品类别", httpMethod = "GET")
    @GetMapping(value = "/api/selectCategory")
    public Result selectCategory(){
        List<Category> categories = categoryService.selectCategory();
        return Result.seccess(200, "查询成功", categories);
    }

}
